<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE hibernate-mapping PUBLIC
        "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
        "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
    <class name="cn.itcast.shop.order.vo.Order" table="orders">
        <id name="oid">
            <generator class="native" />
        </id>
        <!-- 普通属性 -->
        <property name="total" />
        <property name="ordertime" />
        <property name="state" />
        <property name="name" />
        <property name="addr" />
        <property name="phone" />

        <!-- 关联关系 -->
        <many-to-one name="user" lazy="false" class="cn.itcast.shop.user.domain.User" column="uid">
        </many-to-one>

        <set name="orderItems" order-by="itemid" lazy="false" cascade="save-update">
            <key column="uid" />
            <one-to-many class="cn.itcast.shop.order.vo.OrderItem" />
        </set>
    </class>
</hibernate-mapping>